import { defHttp } from "@/utils/http";

// ERP 药品采购合同 VO
export interface BidPurInvoicesVO {
	id: number; // 主键
	year: string; // 年度
	reasonId: number; // 理由
	contractNo: string; // 合同ID
	contractDate: Date; // 合同日期 (date-time格式)
	whsId: number; // 仓库代码
	name: string; // 名称
	startDate: Date; // 起始日期 (date-time格式)
	endDate: Date; // 终止日期 (date-time格式)
	qty: number; // 数量
	unitPrice: number; // 单价
	totalAmount: number; // 总金额
	suplerId: string; // 供应商
}

// ERP 药品采购合同 API
export const BidPurInvoicesApi = {
	// 查询药品采购合同分页
	getBidPurInvoicesPage: async (params: any) => {
		return await defHttp.get({ url: `/whs/pur-invoices/page`, params });
	},

	// 查询药品采购合同详情
	getBidPurInvoices: async (id: number) => {
		return await defHttp.get({ url: `/whs/pur-invoices/get?id=` + id });
	},

	// 新增药品采购合同
	createBidPurInvoices: async (data: BidPurInvoicesVO) => {
		return await defHttp.post({ url: `/whs/pur-invoices/create`, data });
	},

	// 修改药品采购合同
	updateBidPurInvoices: async (data: BidPurInvoicesVO) => {
		return await defHttp.put({ url: `/whs/pur-invoices/update`, data });
	},

	// 删除药品采购合同
	deleteBidPurInvoices: async (id: number) => {
		return await defHttp.delete({
			url: `/whs/pur-invoices/delete?id=` + id
		});
	},

	// 导出药品采购合同 Excel
	exportBidPurInvoices: async (params: any) => {
		return await defHttp.download({ url: `/whs/pur-invoices/export-excel`, params });
	}
};
